package com.tuton.javanet.chapter03;

import java.io.IOException;
import java.net.ServerSocket;

public class RandomPort {

	
	public static void main(String[] args) throws IOException {
		//如果新建一个ServerSocket时指定的端口是0，那么实际上监听的端口是随机的 
//		ServerSocket serverSocket = new ServerSocket(0); 
		ServerSocket serverSocket = new ServerSocket(8000);
		System.out.println("Listen to the port : " + serverSocket.getLocalPort());

	}

}
